# This file defines the test executables for the project.

# =================
#  Unit Tests
# =================

# --- Buffer Test ---
add_executable(Buffer_test
  Buffer_v2_test.cc
)
target_link_libraries(Buffer_test
  PRIVATE
  GTest::gtest_main # Use gtest_main to get main() function automatically
  sola_net # Linking against sola_net will also bring in sola_base
)


# --- Timestamp Test ---
add_executable(Timestamp_test
  Timestamp_v2_test.cc
)
target_link_libraries(Timestamp_test
  PRIVATE
  GTest::gtest_main
  sola_net
  Threads::Threads # Required for std::thread
)

# --- TimerQueue Test ---
add_executable(TimerQueue_test
  TimerQueue_test.cc
)
target_link_libraries(TimerQueue_test
  PRIVATE
  GTest::gtest_main
  sola_net
  Threads::Threads # Required for std::thread
)

# =================
#  Integration Tests
# =================

add_executable(TcpServer_Client_Integration_test
  TcpServer_Client_Integration_test.cc
)
target_link_libraries(TcpServer_Client_Integration_test
  PRIVATE
  GTest::gtest_main
  sola_net
  Threads::Threads
)


# =================
# CTest Integration
# =================
include(GoogleTest)
gtest_discover_tests(Buffer_test)
gtest_discover_tests(Timestamp_test)
gtest_discover_tests(TimerQueue_test)
gtest_discover_tests(TcpServer_Client_Integration_test)
